<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="${package}.mapper.${ClassName}Mapper">

    <resultMap type="${package}.pojo.vo.${ClassName}VO" id="${className}Map">
        <#list gridList as field>
            <result property="${field.attrName}" column="${field.fieldName}"/>
        </#list>
    </resultMap>

    <select id="get${ClassName}Page" resultMap="${className}Map">
        select * from ${tableName}
        <where>
            <#list queryList as field>
                <#if  field.queryType == 'like'>
                    <if test="params.${field.attrName} !=null and params.${field.attrName} !=''">
                        and ${field.fieldName} like concat('%',${"#"}{params.${field.attrName}}, '%')
                    </if>
                <#elseif field.queryType == 'date'>
                    <if test="params.${field.attrName} !=null and params.${field.attrName} !=''">
                        and ${field.fieldName} between ${"#"}{params.${field.attrName}} and ${"#"}{params.${field.attrName}}
                    </if>
                <#elseif field.queryType == 'datetime'>
                    <if test="params.${field.attrName} !=null and params.${field.attrName} !=''">
                        and ${field.fieldName} between ${"#"}{params.${field.attrName}} and ${"#"}{params.${field.attrName}}
                    </if>
                <#else>
                    <if test="params.${field.attrName} !=null and params.${field.attrName} !=''">
                        and ${field.fieldName} ${field.queryType} ${"#"}{params.${field.attrName}}
                    </if>
                </#if>
            </#list>
        </where>
    </select>
</mapper>